hysop.operator.base.derivative module¶
- class hysop.operator.base.derivative.FiniteDifferencesSpaceDerivativeBase(**kwds)[source]¶
Bases:
SpaceDerivativeBase
SpaceDerivative operator base.
Compute the derivative of a field in a given direction on a given backend, possibly scaled by another field/parameter/value.
dF = A * dF/dxj
- Parameters:
F (hysop.field.continuous_field.ScalarField) – Continuous field as input.
dF (hysop.field.continuous_field.ScalarField) – Continuous field to be written. Some backend may allow inplace differentiation.
A (numerical value, ScalarParameter or ScalarField, optional) – Scaling for convenience, defaults to 1.
derivative (int or tuple, optional) – Which derivative to generate, defaults to (0,)*(dim-1)+(1,). ie. first order derivative in X axis. If integer is given, the derivative is taken in given direction.
direction (int, optional) – Directions in which to take the derivative. Defaults to None. Should be None if derivative is a tuple.
require_tmp (bool, optional) – Should this operator generate a tmp array ? Default to True if F is dF (inplace computation) else False.
variables (dict) – Dictionary of fields as keys and topology descriptors as values.
name (str, optional) – Name of this operator
pretty_name (str, optional) – Pretty name of this operator.
kwds (dict, optional) – Base class keyword arguments.
Notes
- There is two way to build a derivative:
- derivative(int) + direction(int) gives:
- => derivative=(0,0,0,0,kd,0,0,0)
where the index of kd is direction and kd=derivative
- derivative(tuple) + direction(None) gives:
=> derivative=(k0,…,kn)
- class hysop.operator.base.derivative.SpaceDerivativeBase(F, dF, A=None, derivative=None, direction=None, variables=None, name=None, pretty_name=None, require_tmp=None, **kwds)[source]¶
Bases:
object
Common implementation interface for derivative operators.
SpaceDerivative operator base.
Compute the derivative of a field in a given direction on a given backend, possibly scaled by another field/parameter/value.
dF = A * dF/dxj
- Parameters:
F (hysop.field.continuous_field.ScalarField) – Continuous field as input.
dF (hysop.field.continuous_field.ScalarField) – Continuous field to be written. Some backend may allow inplace differentiation.
A (numerical value, ScalarParameter or ScalarField, optional) – Scaling for convenience, defaults to 1.
derivative (int or tuple, optional) – Which derivative to generate, defaults to (0,)*(dim-1)+(1,). ie. first order derivative in X axis. If integer is given, the derivative is taken in given direction.
direction (int, optional) – Directions in which to take the derivative. Defaults to None. Should be None if derivative is a tuple.
require_tmp (bool, optional) – Should this operator generate a tmp array ? Default to True if F is dF (inplace computation) else False.
variables (dict) – Dictionary of fields as keys and topology descriptors as values.
name (str, optional) – Name of this operator
pretty_name (str, optional) – Pretty name of this operator.
kwds (dict, optional) – Base class keyword arguments.
Notes
- There is two way to build a derivative:
- derivative(int) + direction(int) gives:
- => derivative=(0,0,0,0,kd,0,0,0)
where the index of kd is direction and kd=derivative
- derivative(tuple) + direction(None) gives:
=> derivative=(k0,…,kn)
- class hysop.operator.base.derivative.SpectralSpaceDerivativeBase(testing=False, **kwds)[source]¶
Bases:
SpectralOperatorBase
,SpaceDerivativeBase
Initialize a spectral operator base. kwds: dict
Base class keyword arguments.